package com.hyl;

import com.hyl.creature.Creature;
import com.hyl.creature.Monster;

/**
 * @description:
 * @author: molar
 * @date: Created in 2020/6/14 16:37
 * @version:
 * @modified By:
 */
public class Ui {
    public void displayBackground() {
        System.out.println("————————————————————————————————游戏背景————————————————————————————————");
        System.out.println("    “啊——”");
        System.out.println("    东边的屋子里传来一声中年女人的尖叫声，在漆黑安静的夜里显得极为悲凄。这已经是这个月");
        System.out.println("里深夜里的第12次尖叫了。");
        System.out.println("    东边屋子里的烛光大亮，身在客房的林生立马赶向传出尖叫的主人东屋。还未到门前，就见一");
        System.out.println("脸怒容的男主人在女人的哭泣声中，拿着火把和棍棒推门而出。此时的门外已经快速的聚集起了火");
        System.out.println("一光片，原是自那一声尖叫声起周围人家的居民就拿起火把、抄起铁锹棍棒等赶紧赶了过来。");
        System.out.println("    男主人快步上前打开大门，面含怒气对那赶来的村民急道：“刚刚那偷婴孩的怪兽又来了！”");
        System.out.println("    人群前带头的村长听此赶忙说，那怪兽肯定还没有跑远，大家快分头找。林生赶忙出门向一个");
        System.out.println("村民打听清楚了事情的原委之后也加入到了找怪兽的过程中。");
        System.out.println("    经过大家一番搜索，成功的找到了妖怪藏身的洞口。据林生了解，以前村名们在村里追打怪兽");
        System.out.println("时都以失败告终，并且受伤严重。他推测普通村名根本难以战胜妖怪，于是便告诉村民他是青云宗");
        System.out.println("下山历练的弟子，成功几率会高上许多，自请入内救出婴孩。村民们听此感激不尽。");
        System.out.println("\n");
    }

    public void displayWelcome() {
        System.out.println("欢迎来到拯救小可爱游戏！");
        System.out.println("这是一个考验运气的游戏！");
        System.out.println("现在游戏正式开始！");
        System.out.println("新手指南：下达help指令可知");
        System.out.println("结束游戏：下达bye指令");
    }

    public void displayHelpMsg() {
        System.out.println("有5种可用指令：--go(go 01) attack(attack wolf1) cure(cure babys or cure me) bye help--");
        System.out.println("每个洞穴中可用的指令有所不同！");
    }

    public void displayStaus(Sense sense, String id) {
        System.out.println("———————————————————————————————————————————————");
        System.out.println(sense.getPlayer().getDescription() + ":" + sense.getPlayer().getHPValue());
        if (id.equals("01")) {
            for (Monster item : sense.getEntranceMonsterSet().getEntranceMonsters()) {
                System.out.print(item.getId() + "(" + item.getDescription() + "):" + item.getHPValue() + " ");
            }
        }
        if (id.equals("02")) {
            for (Monster item : sense.getMiddleCaveMonsterSet().getMiddleMonsters()) {
                System.out.print(item.getId() + "(" + item.getDescription() + "):" + item.getHPValue() + " ");
            }
        }
        if (id.equals("03")) {
            for (Monster item : sense.getWolfCaveMonsterSet().getWolfCaveMonsters()) {
                System.out.print(item.getId() + "(" + item.getDescription() + "):" + item.getHPValue() + " ");
            }
        }
        if (id.equals("04")) {
            for (Creature item : sense.getRattanCaveMonsterSet().getRattanCaveCreatures()) {
                System.out.print(item.getId() + "(" + item.getDescription() + "):" + item.getHPValue() + " ");
            }
        }
        if (id.equals("05")) {
            System.out.print("");
        }
        if (id.equals("06")) {
            System.out.print("这里什么都没有");
        }
        System.out.println("");
        System.out.println("———————————————————————————————————————————————");
    }

    public void displayPlace(Cave cave){
        System.out.println("你在" + cave.getId()+"("+cave.getDescription()+")");
        System.out.print("出口有: ");
        if(cave.getEastExit() != null)
            System.out.print(cave.getEastExit().getId()+"("+cave.getEastExit().getDescription()+") ");
        if(cave.getSouthExit() != null)
            System.out.print(cave.getSouthExit().getId()+"("+cave.getSouthExit().getDescription()+") ");
        if(cave.getWestExit() != null)
            System.out.print(cave.getWestExit().getId()+"("+cave.getWestExit().getDescription()+") ");
        if(cave.getNorthExit() != null)
            System.out.print(cave.getNorthExit().getId()+"("+cave.getNorthExit().getDescription()+") ");
        System.out.println();
    }

    public void displayThen(Sense sense, String id){
        System.out.print("这里的生物或物品有:");
        if (id.equals("01")) {
            for (Monster item : sense.getEntranceMonsterSet().getEntranceMonsters()) {
                System.out.print(item.getId() + "(" + item.getDescription() + "):" + item.getHPValue() + " ");
            }
        }
        if (id.equals("02")) {
            for (Monster item : sense.getMiddleCaveMonsterSet().getMiddleMonsters()) {
                System.out.print(item.getId() + "(" + item.getDescription() + "):" + item.getHPValue() + " ");
            }
        }
        if (id.equals("03")) {
            for (Monster item : sense.getWolfCaveMonsterSet().getWolfCaveMonsters()) {
                System.out.print(item.getId() + "(" + item.getDescription() + "):" + item.getHPValue() + " ");
            }
        }
        if (id.equals("04")) {
            for (Creature item : sense.getRattanCaveMonsterSet().getRattanCaveCreatures()) {
                System.out.print(item.getId() + "(" + item.getDescription() + "):" + item.getHPValue() + " ");
            }
        }
        if (id.equals("05")) {
            System.out.print("");
        }
        if (id.equals("06")) {
        }
        System.out.println();

    }

    public void displayBye() {
        System.out.println("再见！");
    }

    public void displyErrorCmdMsg() {
        System.out.println("你输入的是非法命令！");
    }

    public void displyDamage(Creature attackCreature, Creature targetCreature){
        System.out.println(attackCreature.getDescription()+"对"+targetCreature.getDescription());
    }
}
